import request from '@/utils/request'

export default {
  //条件查询课程
  getCourseList(page, list, searchObj) {
    return request({
      url: `/eduservice/courseFront/getFrontCourseList/${page}/${list}`,
      method: 'post',
      data: searchObj
    })
  },
  //查询一级分类
  getAllSubjectList() {
    return request({
      url: `/eduservice/subject/getAllSubject`,
      method: 'get',
    })
  },
  //课程详情的方法
  getCourseInfo(courseId) {
    return request({
      url: `/eduservice/courseFront/getFrontCourseInfo/${courseId}`,
      method: 'get',
    })
  },
  //增加课程浏览量的方法
  addCourseViewCount(courseId) {
    return request({
      url: `/eduservice/courseFront/addViewCount/${courseId}`,
      method: 'get',
    })
  },
  //查看课程是否收藏的方法
  getCourseCollect(courseId) {
    return request({
      url: `/eduservice/courseCollect/getCourseCollect/${courseId}`,
      method: 'get',
    })
  },
  //添加收藏的方法
  addCourseCollect(courseId) {
    return request({
      url: `/eduservice/courseCollect/addCourseCollect/${courseId}`,
      method: 'get',
    })
  },
  //取消收藏的方法
  delCourseCollect(id) {
    return request({
      url: `/eduservice/courseCollect/delCourseCollect/${id}`,
      method: 'get',
    })
  },
  //查询一个用户所用户的所有收藏集合对应的课程集合
  getCourseCollectByMemberId() {
    return request({
      url: `/eduservice/courseCollect/getCourseCollectByMemberId`,
      method: 'get',
    })
  },
  //查询在线的用户id
  queryUserId() {
    return request({
      url: `/eduservice/commentFront/queryUserId`,
      method: 'get',
    })
  },
  //查询全部课程信息
  queryCourseList(){
    return request({
      url: `/eduservice/courseFront/queryCourseList`,
      method: 'get',
    })
  },
  //根据名称模糊查询课程
  queryCourseByName(courseName){
    return request({
      url: `/eduservice/courseFront/queryCourseByName/${courseName}`,
      method: 'get',
    })
  },
}
